package thinkingJava.chapter16;

import java.util.Arrays;
import java.util.Collections;

public class StringSorting {
	public static void main(String[] args) {
		String[] sa = new String[20];
		for (int i = 0; i < sa.length; i++) {
			sa[i] = new RandomGenerator.String(5).next();
		}
		System.out.println("Before sort : ");
		System.out.println("\t " + Arrays.toString(sa));
		Arrays.sort(sa);
		System.out.println("After sort : ");
		System.out.println("\t " + Arrays.toString(sa));
		Arrays.sort(sa, Collections.reverseOrder());
		System.out.println("ReverseOrder : ");
		System.out.println("\t " + Arrays.toString(sa));
		Arrays.sort(sa, String.CASE_INSENSITIVE_ORDER);
		System.out.println("Case-insensitive order : ");
		System.out.println("\t " + Arrays.toString(sa));
	}
}
